﻿#pragma once

class FSMState;
class GameObject;

class FSM
{
public:
	enum State { st_none = 0, st_idle, st_move, st_attack, st_dir, st_num };
	struct Move
	{
		POINT pt;
		int dirIdx;
	};

	struct Dir
	{
		int dirIdx;
	};

	struct Attack
	{
		int targetId;
		GameObject *target;
		int attackType;
		int dirIdx;
	};

	struct UseSkill
	{
		int targetId;
		GameObject *target;
		int skillIdx;
		int dirIdx;
	};
public:
	FSM();
	virtual ~FSM();

	void Update();
	void ChangeToNextState(State nextNextState = st_idle);
	void SetNextState(State state);
	void SetNextState_move(Move *move);
	void SetNextState_attack(Attack *attack);
	void SetNextState_dir(Dir *dir);
	State GetNextState();

	FSMState *m_states[st_num];
	FSMState *m_currentState = nullptr;
	State m_nextState;
	Move m_move;
	Dir m_dir;
	Attack m_attack;
	UseSkill m_useSkill;
};

